package org.pupil.socket.serialization;

import org.pupil.common.constants.RpcSerialization;
import org.pupil.spi.ExtensionLoader;

import java.io.IOException;

/**
 * @Description: 序列化工厂
 * @Author: pupil
 * @Date: 2024/07/07 下午 1:21
 */
public class SerializationFactory {

    public static Serialization get(RpcSerialization rpcSerialization) {
        return ExtensionLoader.getInstance().get(rpcSerialization.name);
    }

    public static void init() throws IOException, ClassNotFoundException {
        ExtensionLoader.getInstance().loadExtension(Serialization.class);
    }
}
